***************
*** SCATTER ***
***************
	
	*** Load data
		use "$output/combined_data.dta", clear
		capture drop _merge
		drop *_pop
		drop if year < 1960
		reshape wide $datasets, i(ccode country) j(year)

	*** Define start/end
		gen outcome1960 = (log(pwt2000/pwt1960)/(2000 - 1960))*100
		gen initial1960 = log(pwt1960)
		gen outcome2000 = (log(pwt2019/pwt1995)/(2019 - 1995))*100
		gen initial2000 = log(pwt1995)

		tokenize 1960 2000 2019
		local i = 1
		forval n = 1/2{
			local j = `i' + 1
			#delimit ;
				tw 	(lfitci outcome``i'' initial``i'', fcolor(gs10))
					(sc outcome``i'' initial``i'', msymbol(none) mlabsize(vsmall) mlabel(ccode) mlabpos(0) mlabc(black)),
					ytitle("Growth: ``i'' to ``j''")
					xtitle("``i'' income")
					legend(off)
					plotregion(style(none) lcolor(black))  
					xlabel(6.2 "$500" 6.9 "$1k" 7.6 "$2k" 8.5 "$5k" 9.9 "$20k", angle(0)) 
					ylabel(-4 "-4%" -2 "-2%" 0 "0%" 2 "2%" 4 "4%" 6 "6%" 8 "8%", notick nogrid)
					graphregion(fcol(white) lcol(white)) 
					xsize(2) ysize(4) scale(1.5)
				;
			#delimit cr
			graph export "$figures/scatter_``i''_``j''.pdf", replace 
			local ++i
		}
			
	exit

	#delimit ;
	tw	(pcarrow outcome60 initial60 outcome00 initial00),
		ytitle("Growth: Initial year to 2019")
		xtitle("Initial income (1960 or 2000)")
		title("Arrows point from 1960 position to 2000 position")
		xsize(4) ysize(4)
	;
	#delimit cr
	
	exit
